<!doctype html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="description" content="">
    <meta name="keywords" content="">
    <meta name="viewport"
          content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <title>管理员登录</title>

    <!-- Set render engine for 360 browser -->
    <meta name="renderer" content="webkit">

    <!-- No Baidu Siteapp-->
    <meta http-equiv="Cache-Control" content="no-siteapp"/>

    <link rel="icon" type="image/png" href="__Cssjs__/assets/i/favicon.png">

    <!-- Add to homescreen for Chrome on Android -->
    <meta name="mobile-web-app-capable" content="yes">
    <link rel="icon" sizes="192x192" href="__Cssjs__/assets/i/app-icon72x72@2x.png">

    <!-- Add to homescreen for Safari on iOS -->
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-title" content="Amaze UI"/>
    <link rel="apple-touch-icon-precomposed" href="__Cssjs__/assets/i/app-icon72x72@2x.png">

    <!-- Tile icon for Win8 (144x144 + tile color) -->
    <meta name="msapplication-TileImage" content="__Cssjs__/assets/i/app-icon72x72@2x.png">
    <meta name="msapplication-TileColor" content="#0e90d2">

    <!-- SEO: If your mobile URL is different from the desktop URL, add a canonical link to the desktop page https://developers.google.com/webmasters/smartphone-sites/feature-phones -->
    <!--
    <link rel="canonical" href="http://www.example.com/">
    -->
    <link rel="stylesheet" href="__Cssjs__/assets/css/amazeui.min.css">
    <link rel="stylesheet" href="__Cssjs__/assets/css/app.css">
</head>
<body>
<header>
</header>

<div class="log">
    <div class="am-g">
        <div class="am-u-lg-3 am-u-md-6 am-u-sm-8 am-u-sm-centered log-content">
            <form class="am-form" id="log-form">
                <div class="am-input-group am-radius am-animation-slide-left">
                    <input type="text" id="username" class="am-radius" placeholder="用户名" onkeypress="if (event.keyCode == 13) login();">
                    <span class="am-input-group-label log-icon am-radius"><i class="am-icon-user am-icon-sm am-icon-fw"></i></span>
                </div>
                <br>
                <div class="am-input-group am-animation-slide-left log-animation-delay">
                    <input type="password" id="password" class="am-form-field am-radius log-input" placeholder="密码" onkeypress="if (event.keyCode == 13) login();">
                    <span class="am-input-group-label log-icon am-radius"><i class="am-icon-lock am-icon-sm am-icon-fw"></i></span>
                </div>
                <div id="login_error"></div>
                <br>
                <button type="button" onclick="login()" class="am-btn am-btn-primary am-btn-block am-btn-lg am-radius am-animation-slide-bottom log-animation-delay">登 录</button>
            </form>
        </div>
    </div>
    <footer class="log-footer">
        © 版权所有 @ 2010-2017 苏州八百里网络科技有限公司，保留所有权利.
    </footer>
</div>

<!--[if (gte IE 9)|!(IE)]><!-->
<script src="__Cssjs__/assets/js/jquery.min.js"></script>
<!--<![endif]-->
<!--[if lte IE 8 ]>
<script src="http://libs.baidu.com/jquery/1.11.3/jquery.min.js"></script>
<script src="http://cdn.staticfile.org/modernizr/2.8.3/modernizr.js"></script>
<script src="__Cssjs__/assets/js/amazeui.ie8polyfill.min.js"></script>
<![endif]-->
<script src="__Cssjs__/assets/js/amazeui.min.js"></script>
<script src="__Cssjs__/assets/js/app.js"></script>
<script src="__Cssjs__/assets/js/amazeui.dialog.min.js"></script>
<script type="text/javascript">
    function login() {
        var username=$("#username").val();
        var password=$("#password").val();
        $.ajax({
            url:"/admin/login/vali",
            type:"post",
            data:{"username":username,"password":password},
            dataType:"json",
            success:function (data) {
                if(data=='success'){
                    window.location.href='/admin';
                }else {
                    $("#login_error").html("<font style='color: red'>帐号或密码错误</font>")
                }
            },
            error:function (jqXHR) {
                alert("AJAX错误，返回状态："+jqXHR.status);
            }
        })
    }
</script>
</body>
</html>